<template>
  <div class="loop-table-area">
    <el-table
      :data="tableData"
      style="width: 100%; margin-top: 10px"
      row-key="id"
      border
      :default-expand-all="true"
      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
      :row-style="{ height: '60px' }"
    >
      <el-table-column prop="name" label="项目" width="280">
        <template slot-scope="scope">
          <span
            :class="
              scope.row.name == '四、物联网卡数'
                ? 'red-name'
                : scope.row.name == '一、设备计量回路总数（M+N+O）' ||
                  scope.row.name == '二、点位计量设备回路合计数（Z）' ||
                  scope.row.name == '三、跨房间计量设备回路数（A）'
                ? 'blue-name'
                : ''
            "
          >
            {{ scope.row.name }}
          </span>
        </template>
      </el-table-column>
      <el-table-column prop="floor0" label="负一层" align="center" width="70">
      </el-table-column>
      <el-table-column prop="floor1" label="一层" align="center">
      </el-table-column>
      <el-table-column prop="floor2" label="二层" align="center">
      </el-table-column>
      <el-table-column prop="floor3" label="三层" align="center">
      </el-table-column>
      <el-table-column prop="floor4" label="四层" align="center">
      </el-table-column>
      <el-table-column prop="floor5" label="五层" align="center">
      </el-table-column>
      <el-table-column prop="floor6" label="六层" align="center">
      </el-table-column>
      <el-table-column prop="floor7" label="七层" align="center">
      </el-table-column>
      <el-table-column prop="floor8" label="八层" align="center">
      </el-table-column>
      <el-table-column prop="floor9" label="九层" align="center">
      </el-table-column>
      <el-table-column prop="floor10" label="十层" align="center">
      </el-table-column>
      <el-table-column prop="floor11" label="十一层" align="center">
      </el-table-column>
      <el-table-column prop="floor12" label="十二层" align="center">
      </el-table-column>
      <el-table-column
        prop="floorshitang1"
        label="食堂一层"
        width="90"
        align="center"
      >
      </el-table-column>
      <el-table-column prop="elevator" label="电梯" align="center">
      </el-table-column>
      <el-table-column prop="allSum" label="合计" align="center">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    choseTab: {
      type: Number,
      default: -1,
    },
  },
  data() {
    return {
      tableData: [],
      deviceArr: [
        {
          id: 1,
          name: "一、设备计量回路总数（M+N）",
          floor0: 2,
          floor1: 65,
          floor2: 69,
          floor3: 60,
          floor4: 71,
          floor5: 60,
          floor6: 67,
          floor7: 66,
          floor8: 129,
          floor9: 72,
          floor10: 24,
          floor11: 34,
          floor12: 30,
          floorshitang1: 5,
          elevator: 3,
          allSum: 757,
          children: [
            {
              id: 11,
              name: "1、单独计量设备回路数M（含15路水表）",
              floor0: 2,
              floor1: 36,
              floor2: 59,
              floor3: 36,
              floor4: 58,
              floor5: 48,
              floor6: 42,
              floor7: 54,
              floor8: 112,
              floor9: 57,
              floor10: 19,
              floor11: 23,
              floor12: 21,
              floorshitang1: 5,
              elevator: 3,
              allSum: 590,
            },
            // {
            //   id: 12,
            //   name: "2、公共计量设备回路数N",
            //   floor0: 0,
            //   floor1: 4,
            //   floor2: 5,
            //   floor3: 6,
            //   floor4: 4,
            //   floor5: 6,
            //   floor6: 3,
            //   floor7: 5,
            //   floor8: 6,
            //   floor9: 9,
            //   floor10: 2,
            //   floor11: 7,
            //   floor12: 2,
            //   floorshitang1: 0,
            //   elevator: 0,
            //   allSum: 59,
            // },
            {
              id: 13,
              name: "2、备用设备回路数N（分空开备用、模块备用）",
              floor0: 0,
              floor1: 29,
              floor2: 10,
              floor3: 9,
              floor4: 13,
              floor5: 12,
              floor6: 25,
              floor7: 12,
              floor8: 17,
              floor9: 15,
              floor10: 5,
              floor11: 11,
              floor12: 9,
              floorshitang1: 0,
              elevator: 0,
              allSum: 167,
            },
          ],
        },
        // {
        //   id: 4,
        //   name: "二、点位计量设备回路合计数（Z）",
        //   floor0: 2,
        //   floor1: 78,
        //   floor2: 86,
        //   floor3: 69,
        //   floor4: 96,
        //   floor5: 71,
        //   floor6: 84,
        //   floor7: 92,
        //   floor8: 121,
        //   floor9: 93,
        //   floor10: 44,
        //   floor11: 43,
        //   floor12: 32,
        //   floorshitang1: 5,
        //   elevator: 3,
        //   allSum: 919,
        // },
        // {
        //   id: 5,
        //   name: "三、跨房间计量设备回路数（A）",
        //   floor0: 0,
        //   floor1: 9,
        //   floor2: 18,
        //   floor3: 7,
        //   floor4: 22,
        //   floor5: 7,
        //   floor6: 13,
        //   floor7: 18,
        //   floor8: 0,
        //   floor9: 13,
        //   floor10: 7,
        //   floor11: 5,
        //   floor12: 5,
        //   floorshitang1: 0,
        //   elevator: 0,
        //   allSum: 124,
        // },
        {
          id: 6,
          name: "二、物联网卡数",
          floor0: 2,
          floor1: 5,
          floor2: 5,
          floor3: 6,
          floor4: 6,
          floor5: 6,
          floor6: 6,
          floor7: 6,
          floor8: 89,
          floor9: 6,
          floor10: 4,
          floor11: 5,
          floor12: 4,
          floorshitang1: 2,
          elevator: 3,
          allSum: 155,
        },
      ],
      deviceArr0: [
        {
          id: 1,
          name: "一、设备计量回路总数（M+N+O）",
          floor0: "-",
          floor1: "-",
          floor2: "-",
          floor3: "-",
          floor4: "-",
          floor5: "-",
          floor6: "-",
          floor7: "-",
          floor8: 58,
          floor9: "-",
          floor10: "-",
          floor11: "-",
          floor12: "-",
          floorshitang1: "-",
          elevator: "-",
          allSum: 58,
          children: [
            {
              id: 11,
              name: "1、单独计量设备回路数M",
              floor0: "-",
              floor1: "-",
              floor2: "-",
              floor3: "-",
              floor4: "-",
              floor5: "-",
              floor6: "-",
              floor7: "-",
              floor8: 58,
              floor9: "-",
              floor10: "-",
              floor11: "-",
              floor12: "-",
              floorshitang1: "-",
              elevator: "-",
              allSum: 58,
            },
            {
              id: 12,
              name: "2、公共计量设备回路数N",
              floor0: "-",
              floor1: "-",
              floor2: "-",
              floor3: "-",
              floor4: "-",
              floor5: "-",
              floor6: "-",
              floor7: "-",
              floor8: 0,
              floor9: "-",
              floor10: "-",
              floor11: "-",
              floor12: "-",
              floorshitang1: "-",
              elevator: "-",
              allSum: 0,
            },
            {
              id: 13,
              name: "3、备用设备回路数O",
              floor0: "-",
              floor1: "-",
              floor2: "-",
              floor3: "-",
              floor4: "-",
              floor5: "-",
              floor6: "-",
              floor7: "-",
              floor8: 0,
              floor9: "-",
              floor10: "-",
              floor11: "-",
              floor12: "-",
              floorshitang1: "-",
              elevator: "-",
              allSum: 0,
            },
          ],
        },
        {
          id: 4,
          name: "二、点位计量设备回路合计数（Z）",
          floor0: "-",
          floor1: "-",
          floor2: "-",
          floor3: "-",
          floor4: "-",
          floor5: "-",
          floor6: "-",
          floor7: "-",
          floor8: 58,
          floor9: "-",
          floor10: "-",
          floor11: "-",
          floor12: "-",
          floorshitang1: "-",
          elevator: "-",
          allSum: 58,
        },
        {
          id: 5,
          name: "三、跨房间计量设备回路数（A）",
          floor0: "-",
          floor1: "-",
          floor2: "-",
          floor3: "-",
          floor4: "-",
          floor5: "-",
          floor6: "-",
          floor7: "-",
          floor8: 0,
          floor9: "-",
          floor10: "-",
          floor11: "-",
          floor12: "-",
          floorshitang1: "-",
          elevator: "-",
          allSum: 0,
        },
      ],
      deviceArr1: [
        {
          id: 1,
          name: "一、设备计量回路总数（M+N+O）",
          floor0: "-",
          floor1: "-",
          floor2: "-",
          floor3: "-",
          floor4: "-",
          floor5: "-",
          floor6: "-",
          floor7: "-",
          floor8: 27,
          floor9: "-",
          floor10: "-",
          floor11: "-",
          floor12: "-",
          floorshitang1: "-",
          elevator: "-",
          allSum: 27,
          children: [
            {
              id: 11,
              name: "1、单独计量设备回路数M",
              floor0: "-",
              floor1: "-",
              floor2: "-",
              floor3: "-",
              floor4: "-",
              floor5: "-",
              floor6: "-",
              floor7: "-",
              floor8: 27,
              floor9: "-",
              floor10: "-",
              floor11: "-",
              floor12: "-",
              floorshitang1: "-",
              elevator: "-",
              allSum: 27,
            },
            {
              id: 12,
              name: "2、公共计量设备回路数N",
              floor0: "-",
              floor1: "-",
              floor2: "-",
              floor3: "-",
              floor4: "-",
              floor5: "-",
              floor6: "-",
              floor7: "-",
              floor8: 0,
              floor9: "-",
              floor10: "-",
              floor11: "-",
              floor12: "-",
              floorshitang1: "-",
              elevator: "-",
              allSum: 0,
            },
            {
              id: 13,
              name: "3、备用设备回路数O",
              floor0: "-",
              floor1: "-",
              floor2: "-",
              floor3: "-",
              floor4: "-",
              floor5: "-",
              floor6: "-",
              floor7: "-",
              floor8: 0,
              floor9: "-",
              floor10: "-",
              floor11: "-",
              floor12: "-",
              floorshitang1: "-",
              elevator: "-",
              allSum: 0,
            },
          ],
        },
        {
          id: 4,
          name: "二、点位计量设备回路合计数（Z）",
          floor0: "-",
          floor1: "-",
          floor2: "-",
          floor3: "-",
          floor4: "-",
          floor5: "-",
          floor6: "-",
          floor7: "-",
          floor8: 27,
          floor9: "-",
          floor10: "-",
          floor11: "-",
          floor12: "-",
          floorshitang1: "-",
          elevator: "-",
          allSum: 27,
        },
        {
          id: 5,
          name: "三、跨房间计量设备回路数（A）",
          floor0: "-",
          floor1: "-",
          floor2: "-",
          floor3: "-",
          floor4: "-",
          floor5: "-",
          floor6: "-",
          floor7: "-",
          floor8: 0,
          floor9: "-",
          floor10: "-",
          floor11: "-",
          floor12: "-",
          floorshitang1: "-",
          elevator: "-",
          allSum: 0,
        },
      ],
      deviceArr2: [
        {
          id: 1,
          name: "一、设备计量回路总数（M+N+O）",
          floor0: 2,
          floor1: 2,
          floor2: 2,
          floor3: 2,
          floor4: 2,
          floor5: 2,
          floor6: 2,
          floor7: 2,
          floor8: 2,
          floor9: 2,
          floor10: 2,
          floor11: 2,
          floor12: 2,
          floorshitang1: 2,
          elevator: 3,
          allSum: 31,
          children: [
            {
              id: 11,
              name: "1、单独计量设备回路数M",
              floor0: 2,
              floor1: 2,
              floor2: 2,
              floor3: 2,
              floor4: 2,
              floor5: 2,
              floor6: 2,
              floor7: 2,
              floor8: 2,
              floor9: 2,
              floor10: 2,
              floor11: 2,
              floor12: 2,
              floorshitang1: 2,
              elevator: 3,
              allSum: 31,
            },
            {
              id: 12,
              name: "2、公共计量设备回路数N",
              floor0: "-",
              floor1: "-",
              floor2: "-",
              floor3: "-",
              floor4: "-",
              floor5: "-",
              floor6: "-",
              floor7: "-",
              floor8: "-",
              floor9: "-",
              floor10: "-",
              floor11: "-",
              floor12: "-",
              floorshitang1: "-",
              elevator: "-",
              allSum: 0,
            },
            {
              id: 13,
              name: "3、备用设备回路数O",
              floor0: "-",
              floor1: "-",
              floor2: "-",
              floor3: "-",
              floor4: "-",
              floor5: "-",
              floor6: "-",
              floor7: "-",
              floor8: "-",
              floor9: "-",
              floor10: "-",
              floor11: "-",
              floor12: "-",
              floorshitang1: "-",
              elevator: "-",
              allSum: 0,
            },
          ],
        },
        {
          id: 4,
          name: "二、点位计量设备回路合计数（Z）",
          floor0: "-",
          floor1: "-",
          floor2: "-",
          floor3: "-",
          floor4: "-",
          floor5: "-",
          floor6: "-",
          floor7: "-",
          floor8: 1,
          floor9: "-",
          floor10: "-",
          floor11: "-",
          floor12: "-",
          floorshitang1: "-",
          elevator: "-",
          allSum: 15,
        },
        {
          id: 5,
          name: "三、跨房间计量设备回路数（A）",
          floor0: "-",
          floor1: "-",
          floor2: "-",
          floor3: "-",
          floor4: "-",
          floor5: "-",
          floor6: "-",
          floor7: "-",
          floor8: "-",
          floor9: "-",
          floor10: "-",
          floor11: "-",
          floor12: "-",
          floorshitang1: "-",
          elevator: "-",
          allSum: 0,
        },
      ],
      deviceArr3: [
        {
          id: 1,
          name: "一、设备计量回路总数（M+N+O）",
          floor0: 0,
          floor1: 62,
          floor2: 65,
          floor3: 57,
          floor4: 68,
          floor5: 57,
          floor6: 64,
          floor7: 63,
          floor8: 33,
          floor9: 77,
          floor10: 29,
          floor11: 34,
          floor12: 21,
          floorshitang1: 0,
          elevator: 0,
          allSum: 630,
          children: [
            {
              id: 11,
              name: "1、单独计量设备回路数M",
              floor0: 0,
              floor1: 28,
              floor2: 38,
              floor3: 30,
              floor4: 55,
              floor5: 43,
              floor6: 36,
              floor7: 53,
              floor8: 25,
              floor9: 48,
              floor10: 24,
              floor11: 22,
              floor12: 16,
              floorshitang1: 0,
              elevator: 0,
              allSum: 418,
            },
            {
              id: 12,
              name: "2、公共计量设备回路数N",
              floor0: 0,
              floor1: 0,
              floor2: 0,
              floor3: 0,
              floor4: 0,
              floor5: 0,
              floor6: 0,
              floor7: 0,
              floor8: 0,
              floor9: 0,
              floor10: 0,
              floor11: 0,
              floor12: 0,
              floorshitang1: 0,
              elevator: 0,
              allSum: 0,
            },
            {
              id: 13,
              name: "3、备用设备回路数O",
              floor0: 0,
              floor1: 34,
              floor2: 27,
              floor3: 27,
              floor4: 13,
              floor5: 14,
              floor6: 28,
              floor7: 10,
              floor8: 8,
              floor9: 29,
              floor10: 5,
              floor11: 12,
              floor12: 5,
              floorshitang1: 0,
              elevator: 0,
              allSum: 212,
            },
          ],
        },
        {
          id: 4,
          name: "二、点位计量设备回路合计数（Z）",
          floor0: 2,
          floor1: 71,
          floor2: 84,
          floor3: 64,
          floor4: 89,
          floor5: 64,
          floor6: 78,
          floor7: 81,
          floor8: 33,
          floor9: 90,
          floor10: 34,
          floor11: 44,
          floor12: 26,
          floorshitang1: 0,
          elevator: 0,
          allSum: 758,
        },
        {
          id: 5,
          name: "三、跨房间计量设备回路数（A）",
          floor0: 0,
          floor1: 9,
          floor2: 18,
          floor3: 7,
          floor4: 21,
          floor5: 7,
          floor6: 14,
          floor7: 18,
          floor8: 0,
          floor9: 13,
          floor10: 5,
          floor11: 5,
          floor12: 5,
          floorshitang1: 0,
          elevator: 0,
          allSum: 122,
        },
      ],
      deviceArr4: [
        {
          id: 1,
          name: "一、设备计量回路总数（M+N+O）",
          floor0: "-",
          floor1: 1,
          floor2: 1,
          floor3: 1,
          floor4: 1,
          floor5: 1,
          floor6: 1,
          floor7: 1,
          floor8: 1,
          floor9: 1,
          floor10: 1,
          floor11: 1,
          floor12: 1,
          floorshitang1: 3,
          elevator: "-",
          allSum: 15,
          children: [
            {
              id: 11,
              name: "1、单独计量设备回路数M",
              floor0: "-",
              floor1: 1,
              floor2: 1,
              floor3: 1,
              floor4: 1,
              floor5: 1,
              floor6: 1,
              floor7: 1,
              floor8: 1,
              floor9: 1,
              floor10: 1,
              floor11: 1,
              floor12: 1,
              floorshitang1: 3,
              elevator: "-",
              allSum: 15,
            },
            {
              id: 12,
              name: "2、公共计量设备回路数N",
              floor0: "-",
              floor1: "-",
              floor2: "-",
              floor3: "-",
              floor4: "-",
              floor5: "-",
              floor6: "-",
              floor7: "-",
              floor8: "-",
              floor9: "-",
              floor10: "-",
              floor11: "-",
              floor12: "-",
              floorshitang1: "-",
              elevator: "-",
              allSum: 0,
            },
            {
              id: 13,
              name: "3、备用设备回路数O",
              floor0: "-",
              floor1: "-",
              floor2: "-",
              floor3: "-",
              floor4: "-",
              floor5: "-",
              floor6: "-",
              floor7: "-",
              floor8: "-",
              floor9: "-",
              floor10: "-",
              floor11: "-",
              floor12: "-",
              floorshitang1: "-",
              elevator: "-",
              allSum: 0,
            },
          ],
        },
        {
          id: 4,
          name: "二、点位计量设备回路合计数（Z）",
          floor0: "-",
          floor1: 1,
          floor2: 1,
          floor3: 1,
          floor4: 1,
          floor5: 1,
          floor6: 1,
          floor7: 1,
          floor8: 1,
          floor9: 1,
          floor10: 1,
          floor11: 1,
          floor12: 1,
          floorshitang1: 3,
          elevator: "-",
          allSum: 15,
        },
        {
          id: 5,
          name: "三、跨房间计量设备回路数（A）",
          floor0: "-",
          floor1: "-",
          floor2: "-",
          floor3: "-",
          floor4: "-",
          floor5: "-",
          floor6: "-",
          floor7: "-",
          floor8: "-",
          floor9: "-",
          floor10: "-",
          floor11: "-",
          floor12: "-",
          floorshitang1: "-",
          elevator: "-",
          allSum: 0,
        },
      ],
    };
  },
  watch: {
    choseTab: {
      handler(val) {
        if (val || val === 0) {
          console.log("choseTab", val);
          this.ChangeTags(val);
        }
      },
      deep: false,
      immediate: true,
    },
  },
  created() {
    // this.tableData = [...this.deviceArr];
  },
  mounted() {},
  methods: {
    ChangeTags(val) {
      this.tableData = [];
      switch (val) {
        case -1:
          this.tableData = [...this.deviceArr];
          break;
        case 0:
          this.tableData = [...this.deviceArr0];
          break;
        case 1:
          this.tableData = [...this.deviceArr1];
          break;
        case 2:
          this.tableData = [...this.deviceArr2];
          break;
        case 3:
          this.tableData = [...this.deviceArr3];
          break;
        case 4:
          this.tableData = [...this.deviceArr4];
          break;
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.loop-table-area {
  height: 370px;
}
.red-name {
  color: #f56c6c;
  font-weight: bold;
}
.blue-name {
  color: #409eff;
  font-weight: bold;
}
</style>
